package pers.cz.compilation;

import java.util.HashMap;
import java.util.Map;

/**
 * 策略工厂
 * @program: PostGirl-panent
 * @description: TypeFactory
 * @author: Cheng Zhi
 * @create: 2021-11-21 19:07
 **/
public class TypeFactory {

    private  Map<String,ITypeJudge> typeMap;

    public TypeFactory() {
        typeMap = new HashMap();
        typeMap.put("java.util.Date", new DateTypeJudgeImpl());
        typeMap.put("java.lang.Integer", new IntegerTypeJudgeImpl());
        typeMap.put("java.lang.Long", new LongTypeJudgeImpl());
        typeMap.put("java.lang.Double", new DoubleJudgeImpl());
        typeMap.put("java.lang.String", new StringJudgeImpl());
        typeMap.put("java.lang.List", new ListJudgeImpl());
    }

    public ITypeJudge getTypeJudge(String typeName) {
        return typeMap.get(typeName);
    }
}
